import unittest, requests


class jk(unittest.TestCase):
    jkou = 'http://10.59.9.18'

    def setUp(self) -> None:
        print('开始')

    def tearDown(self) -> None:
        print('结束')

    sessionId = None
    userId = None
    # 登录接口 --正面用例 账号密码正确
    message1 = None
    message2 = None
    message3 = None
    message4 = None
    message5 = None
    def test_jk_01(self):
        r1 = requests.post(url=jk.jkou + '/health/user/v1/login',
                           data={'email': '3500186206@qq.com',
                                 'pwd': 'lZjdXyj15cOhn1a0yJKsW7o+fw/ogBDzn6CcyPSJUVIMmCPtCs+zuPwh7IZkXZiRhJvvjdIz9D2z1jkMOtD/36ddaLFMtQd9xIk0jAaDP1TH/lEHvvUPwot6asMGMGkH9EgBPT+4eaYC77BGQBPOASweQZE5KDF8BeN/c0sLfSw='})
        print(r1.json())
        jk.message1 = r1.json()['message']
        self.assertIn('登录成功',jk.message1)
    # 登录接口 --反面用例 密码为空
    def test_jk_02(self):
        r2 = requests.post(url=jk.jkou + '/health/user/v1/login',
                           data={'email': '3500186206@qq.com',
                                 'pwd': ''})
        print(r2.json())
        jk.message2 = r2.json()['message']
        self.assertNotIn('登录成功', jk.message2)
    # 登录接口 --反面用例 用户名格式错误
    def test_jk_03(self):
        r3 = requests.post(url=jk.jkou + '/health/user/v1/login',
                           data={'email': '3500186206',
                                 'pwd': 'lZjdXyj15cOhn1a0yJKsW7o+fw/ogBDzn6CcyPSJUVIMmCPtCs+zuPwh7IZkXZiRhJvvjdIz9D2z1jkMOtD/36ddaLFMtQd9xIk0jAaDP1TH/lEHvvUPwot6asMGMGkH9EgBPT+4eaYC77BGQBPOASweQZE5KDF8BeN/c0sLfSw='})
        print(r3.json())
        jk.message3 = r3.json()['message']
        self.assertIn('失败', jk.message3)
    # 登录接口 --反面用例 用户名未注册
    def test_jk_04(self):
        r4 = requests.post(url=jk.jkou + '/health/user/v1/login',
                           data={'email': '3315608326@qq.com',
                                 'pwd': 'lZjdXyj15cOhn1a0yJKsW7o+fw/ogBDzn6CcyPSJUVIMmCPtCs+zuPwh7IZkXZiRhJvvjdIz9D2z1jkMOtD/36ddaLFMtQd9xIk0jAaDP1TH/lEHvvUPwot6asMGMGkH9EgBPT+4eaYC77BGQBPOASweQZE5KDF8BeN/c0sLfSw='})
        print(r4.json())
        jk.message4 = r4.json()['message']
        self.assertNotIn('成功', jk.message4)
    # 登录接口 --反面用例 用户名存在特殊字符
    def test_jk_05(self):
        r5 = requests.post(url=jk.jkou + '/health/user/v1/login',
                           data={'email': '35*&*186206@qq.com',
                                 'pwd': 'lZjdXyj15cOhn1a0yJKsW7o+fw/ogBDzn6CcyPSJUVIMmCPtCs+zuPwh7IZkXZiRhJvvjdIz9D2z1jkMOtD/36ddaLFMtQd9xIk0jAaDP1TH/lEHvvUPwot6asMGMGkH9EgBPT+4eaYC77BGQBPOASweQZE5KDF8BeN/c0sLfSw='})
        print(r5.json())
        jk.message5 = r5.json()['message']
        self.assertNotIn('成功', jk.message5)
if __name__ == '__main__':
    unittest.main()